<template>
  <CommonDialog
    :visible.sync="dialogVisible"
    :title="dialogTitle"
    :showFooter="false"
    @close="handleClose"
  >
    <CommonForm :config="formConfig" :model="form" :readonly="true">
    </CommonForm>
  </CommonDialog>
</template>

<script>
import CommonDialog from "@/components/CommonDialog";
import CommonForm from "@/components/CommonForm";
export default {
  components: {
    CommonDialog,
    CommonForm,
  },
  data() {
    return {
      dialogVisible: true,
      dialogTitle: "查看信息",
      formConfig: [
        {
          label: "标题",
          props: "title",
          component: "el-input",
        },
        {
          label: "作者",
          props: "author",
          component: "el-input",
        },
        {
          label: "浏览量",
          props: "pageviews",
          component: "el-input",
        },
        {
          label: "状态",
          props: "status",
          component: "el-input",
        },
        {
          label: "创建时间",
          props: "display_time",
          component: "el-input",
        },
      ],
      form: {
        title: "",
        author: "",
        pageviews: "",
        status: "",
        display_time: "",
      },
    };
  },
  computed: {},
  methods: {
    handleOpen(data) {
      this.form = {
        ...data,
      };
    },
    handleClose() {
      this.dialogVisible = false;
      this.$emit("close");
    },
  },
};
</script>

<style lang="scss" scoped>
.el-dialog__wrapper {
  display: flex;
  align-items: center;
  ::v-deep .el-dialog {
    margin-top: 0 !important;
  }
}
</style>
